home *** CD-ROM | disk | FTP | other *** search
/ Floppyshop 2 / Floppyshop - 2.zip / Floppyshop - 2.iso / art&graf.ix / art-4641 / spritefx / source / example.s < prev    next >
Text File  |  1994-05-12  |  18KB  |  679 lines

  1. ******************************************************************** 
  2. ********************************************************************
  3. * This is an example programe using files created with SPRITEFX
  4. * and uses routines that are fairly simple so as to be suitable 
  5. * for beginers. For this reason and because of the fact that the
  6. * sprite routine is universal, handling multiple size sprites, 
  7. * the routines have not been optimised for maximum speed. Also
  8. * the routines are set up to use only variable speed sequence
  9. * files with frame numbers going from low to high and X/Y only
  10. * path files. Full save and restore has been implemented on the
  11. * background which is not always nessecary or could be acheived 
  12. * by other, faster methods but as mentioned above this file was 
  13. *created with beginers in mind. More advanced methods and routines
  14. * have been used in the programe in the demo folder, the source
  15. * code for which can be obtained with the registered version of
  16. * SPRITEFX, please read "reg.txt" on disk. For more details on 
  17. * using SPRITEFX files within your own programes read the manule
  18. * in the "docs" folder.    
  19. ******************************************************************** 
  20. ************************ FILE INFORMATION **************************
  21. * For more detailed information on the following files please read
  22. * SPRITEFX.DOC in the MANUAL folder. The ghost sprites where created
  23. * by using the same sprite screen loaded into SPRITEFX then turning
  24. * off planes 1 and 4 and saving as such.
  25. ********************************************************************
  26. * PATH FILES *
  27. *                        _
  28. * 1 WORD      * SPRITEFX INFORMATION         |-HEADER
  29. * 1 LONGWORD    * NUMBER OF X/Y POSITIONS    _|
  30. *                        _
  31. * 1 WORD    * X POSITION             |-DATA     
  32. * 1 WORD    * Y POSITION             _|
  33. *
  34. * PREVIOUS DATA STRUCTURE TO END OF FILE
  35. *
  36. ******************************************************************** 
  37. * SEQUENCE FILES *
  38. *                        _
  39. * 1 LONGWORD    * SPRITEFX INFORMATION         |-HEADER
  40. * 1 WORD    * SPRITEFX INFORMATION         |
  41. * 1 longWORD    * NUMBER OF SEQUENCES        _|
  42. *                        _
  43. * 1 WORD    * FRAME UPDATE SPEED         |-DATA
  44. * 1 WORD    * START FRAME NUMBER         |
  45. * 1 WORD    * END FRAME NUMBER        _|    
  46. *
  47. * PREVIOUS DATA STRUCTURE TO END OF FILE
  48. * FILE IS TERMINATED WITH -1
  49. *
  50. ******************************************************************** 
  51. * SPRITE FILES *
  52. *                        _                                                        
  53. * 1 WORD    * SPRITEFX INFORMATION         |-HEADER
  54. * 1 WORD    * SPRITEFX INFORMATION         |
  55. * 1 LONGWORD    * NUMBER OF SPRITES         |
  56. * 32 WORDS    * SPRITE PALETTE DATA        _|
  57. *                        _ 
  58. * 1 WORD    * MASK DATA             |-DATA
  59. * 1 WORD    * PLANE 1 SPRITE DATA         |
  60. * 1 WORD    * PLANE 2 SPRITE DATA         |
  61. * 1 WORD    * PLANE 3 SPRITE DATA         |
  62. * 1 WORD    * PLANE 4 SPRITE DATA        _|    
  63. *
  64. * PREVIOUS DATA STRUCTURE TO END OF FILE
  65. ******************************************************************** 
  66. * KEYS:- Esc   = rerun animation.
  67. *     Space = quit program. 
  68. ******************************************************************** 
  69.  
  70.  
  71. start    clr.l   -(sp)            supervisor mode on
  72.     move.w  #$20,-(sp)
  73.     trap    #1
  74.     move.l  d0,savereg        old stack address
  75.     
  76.     lea    stack,a7        new stack address 
  77.  
  78. mouseoff
  79.     move #$12,-(sp)            disable mouse reporting
  80.     move #4,-(sp)
  81.     move #3,-(sp)
  82.     trap #13
  83.     addq.l #6,sp
  84.     
  85.     dc.w $A00A            Line-A hide mouse
  86.  
  87. cursor_off
  88.     clr.w    -(sp)
  89.     move.w    #21,-(sp)
  90.     trap    #14
  91.     addq.l    #4,sp
  92.  
  93.         move.w  $484,sav_484
  94.     bclr    #0,$484            no key click
  95.     bclr    #1,$484            no repeat key
  96.  
  97.     move.w  #4,-(sp)        get current resolution        
  98.     trap    #14
  99.     addq.l  #2,sp
  100.     move.w  d0,oldrez        and save it
  101.  
  102.     move.w    #3,-(sp)        get current screen
  103.     trap    #14
  104.     addq.l    #2,sp
  105.     move.l  d0,oldscr        and save it
  106.  
  107.     movem.l $ffff8240.w,d0-d7    save colors...
  108.     movem.l d0-d7,syspal        ..quickly
  109.  
  110.     movem.l spritedata+8,d0-d7    * +8 to skip header
  111.     movem.l d0-d7,$ffff8240.w    new palette
  112.  
  113.     move.l    #screen1,d0        get new physical screen
  114.     add.l    #256,d0
  115.     and.l    #$ffffff00,d0
  116.     move.l    d0,phys            stored address
  117.  
  118.     move.l    #screen2,d0        and new logical screen
  119.     add.l    #256,d0
  120.     and.l    #$ffffff00,d0
  121.     move.l    d0,log            stored address
  122.  
  123. openfile                * load back drop Degas picture
  124.     move.w    #0,-(sp)
  125.     move.l    #picture,-(sp)
  126.     move.w    #$3d,-(sp)
  127.     trap    #1
  128.     addq.l    #8,sp
  129.     tst.w    d0
  130.     bmi    exit
  131.     move.w    d0,handle
  132. loadpalette
  133.     move.l    #palette,-(sp)
  134.     move.l    #34,-(sp)    
  135.     move.w    handle,-(sp)
  136.     move.w    #$3f,-(sp)
  137.     trap    #1
  138.     add.l    #12,sp
  139. loadpicture        
  140.     move.l    #picbuffer,-(sp)
  141.     move.l    #32000,-(sp)    
  142.     move.w    handle,-(sp)
  143.     move.w    #$3f,-(sp)
  144.     trap    #1
  145.     add.l    #12,sp
  146. close    move.w    handle,-(sp)
  147.     move.w    #$3c,-(sp)
  148.     trap    #1
  149.     addq.l    #4,sp
  150.     
  151.     move.w  #0,-(sp)        set low rez
  152.     move.l  phys,-(sp)          phys    
  153.     move.l  log,-(sp)        log
  154.     move.w  #5,-(sp)
  155.     trap    #14
  156.     add.l   #12,sp
  157.  
  158. ****************************************************************** 
  159. * The main programe starts here, if any changes are made or code
  160. * added it may be better to dissable the re-run animation function
  161. * by deleting the check for space being pressed. 
  162. ****************************************************************** 
  163.  
  164. copyscreens            
  165.     lea    picbuffer,a0
  166.     move.l    phys,a1
  167.     move.l    #4000-1,d0
  168. .copy1    move.l    (a0)+,(a1)+    to physical screen    
  169.     move.l    (a0)+,(a1)+    
  170.     dbra    d0,.copy1
  171.     lea    picbuffer,a0
  172.     move.l    log,a1
  173.     move.l    #4000-1,d0
  174. .copy2    move.l    (a0)+,(a1)+    to logical screen    
  175.     move.l    (a0)+,(a1)+    
  176.     dbra    d0,.copy2
  177.  
  178. * create sprite address table
  179.     move.l    spritedata+4,d0        number of sprites in the file
  180.     subq.l    #1,d0
  181.     lea    sprite_table,a0
  182.     lea    spritedata+8+32,a1    first sprite block
  183. .loop    move.l    a1,(a0)+    
  184.     addq.l    #8,a1            skip hight/width/length
  185.     add.l    -4(a1),a1        add length to current position
  186.     dbra    d0,.loop            
  187.  
  188.     clr.l    data_buffer_1a        * clear begining of data buffers
  189.     clr.l    back_buffer_1a
  190.     clr.l    data_buffer_2b
  191.     clr.l    back_buffer_2b
  192.     move.l    #data_buffer_1a,datbuf1    * and store addresses
  193.     move.l    #back_buffer_1a,bakbuf1
  194.     move.l    #data_buffer_2b,datbuf2
  195.     move.l    #back_buffer_2b,bakbuf2
  196.  
  197. * set up variables
  198.  
  199.     clr.b    video            mainly for re-run function
  200.     move.l    #sequence+10,seq_pos
  201.     
  202.     move.l    #path+6,pathpos        
  203.     move.l    seq_pos,a0        position in the sequence file
  204.     move.w    (a0)+,delay        frame update delay
  205.     move.w    delay,countdown
  206.     move.w    (a0)+,frame        sequence start
  207.     move.w    (a0)+,seqend        sequence end
  208. sync
  209.     move.w    #37,-(sp)        xbios vsync
  210.     trap    #14
  211.     addq.l    #2,sp
  212.  
  213.     move.w    #$ff,-(sp)        gemdos rawconio
  214.     move.w    #6,-(sp)
  215.     trap    #1
  216.     addq.l    #4,sp
  217.     
  218.     cmpi.b    #27,d0            Esc ?  if so quit
  219.     beq    exit
  220.     cmpi.b    #' ',d0            Space ? if so re-run
  221.     beq    copyscreens            
  222.  
  223.     cmp.l    #path1end,pathpos    at end of current path?
  224.     blt    update            if not then update possition            
  225.     bra    anim2            if so the do next animation                    
  226. update    move.l    pathpos,a0        currnet position in the path file
  227.     add.l    #4,pathpos        increment position
  228.     move.w    (a0)+,x_pos        get X position
  229.     move.w    (a0),y_pos        get Y position
  230.  
  231.     tst.w    countdown        end of delay?
  232.     bpl    .ok2            no then continue
  233.     addq.w    #1,frame        yes so increment frame number
  234.     move.w    seqend,d0        last frame number in the sequence
  235.     cmp.w    frame,d0        last frame in the sequence?
  236.     blt    .nxtseq            yes so reset variables
  237.     move.w    delay,countdown        no so just reset frame delay                            
  238.     bra    .ok2            and continue    
  239. .nxtseq    add.l    #6,seq_pos        get next sequence    
  240.     move.l    seq_pos,a0        position in the sequence file
  241.     tst.w    (a0)            at end of sequence file?
  242.     bpl    .ok            if no then continue
  243.     bra    anim2            if yes then go to animation 2
  244. .ok    move.l    seq_pos,a0        position in the sequence file
  245.     move.w    (a0)+,delay        frame update delay
  246.     move.w    delay,countdown        and reset delay couter        
  247.     move.w    (a0)+,frame        sequence start
  248.     move.w    (a0)+,seqend        sequence end
  249. .ok2    subq.w    #1,countdown        decrement delay counter
  250.  
  251.     move.w    frame,d0        current frame number
  252.     asl.w    #2,d0            multiply by 4
  253.     lea    sprite_table,a0        sprite addresses
  254.     move.l    0(a0,d0.w),a0        correct sprite block
  255.     move.w    (a0)+,hight    
  256.     move.w    (a0)+,width
  257.     addq.l    #4,a0            skip length    
  258.     move.l    a0,sprite        store address of sprite
  259.     bsr    sprite_routine        
  260.  
  261.     bsr    swapscreens
  262.     bra    sync
  263.  
  264. anim2    
  265. * create new sprite address table
  266.     move.l    ghostdata+4,d0        number of sprites in the file
  267.     subq.l    #1,d0
  268.     lea    sprite_table,a0
  269.     lea    ghostdata+8+32,a1    first sprite block
  270. .loop    move.l    a1,(a0)+    
  271.     addq.l    #8,a1            skip hight/width/length
  272.     add.l    -4(a1),a1        add length to current position
  273.     dbra    d0,.loop            
  274.  
  275.     clr.l    data_buffer_1a        
  276.     clr.l    back_buffer_1a
  277.     clr.l    data_buffer_2b
  278.     clr.l    back_buffer_2b
  279.  
  280.     move.l    #path2+6,pathpos    
  281.  
  282.     move.l    #sequence2+10,seq_pos
  283.     move.l    seq_pos,a0        position in the sequence file
  284.     move.w    (a0)+,delay        frame update delay
  285.     move.w    delay,countdown
  286.     move.w    (a0)+,frame        sequence start
  287.     move.w    (a0)+,seqend        sequence end
  288.  
  289.     clr.b    video
  290. sync2
  291.     move.w    #37,-(sp)
  292.     trap    #14
  293.     addq.l    #2,sp
  294.  
  295.     move.w    #$ff,-(sp)
  296.     move.w    #6,-(sp)
  297.     trap    #1
  298.     addq.l    #4,sp
  299.     
  300.     cmpi.b    #27,d0        Esc ?  if so quit
  301.     beq    exit
  302.     cmpi.b    #' ',d0
  303.     beq    copyscreens            
  304.             
  305.     cmp.l    #path2end,pathpos
  306.     blt    update2
  307.     bra    anim3        
  308. update2    move.l    pathpos,a0
  309.     add.l    #4,pathpos
  310.     move.w    (a0)+,x_pos
  311.     move.w    (a0),y_pos
  312.  
  313.     tst.w    countdown        end of delay?
  314.     bpl    .ok2
  315.     addq.w    #1,frame        yes so increment frame number
  316.     move.w    seqend,d0
  317.     cmp.w    frame,d0        last frame in the sequence?
  318.     blt    .nxtseq            yes so reset variables
  319.     move.w    delay,countdown        no so just reset frame delay                            
  320.     bra    .ok2    
  321. .nxtseq    add.l    #6,seq_pos        get next sequence    
  322.     move.l    seq_pos,a0        position in the sequence file
  323.     move.w    (a0)+,delay        frame update delay
  324.     move.w    delay,countdown        
  325.     move.w    (a0)+,frame        sequence start
  326.     move.w    (a0)+,seqend        sequence end
  327.     bra    anim3            go to animation 3
  328. .ok2    subq.w    #1,countdown    
  329.  
  330.     move.w    frame,d0
  331.     asl.w    #2,d0
  332.     lea    sprite_table,a0
  333.     move.l    0(a0,d0.w),a0    correct sprite block
  334.     move.w    (a0)+,hight    
  335.     move.w    (a0)+,width
  336.     addq.l    #4,a0        skip length    
  337.     move.l    a0,sprite
  338.     bsr    sprite_routine
  339.  
  340.     bsr    swapscreens
  341.     bra    sync2
  342.  
  343. anim3
  344. sync3
  345.     move.w    #37,-(sp)
  346.     trap    #14
  347.     addq.l    #2,sp
  348.  
  349.     move.w    #$ff,-(sp)
  350.     move.w    #6,-(sp)
  351.     trap    #1
  352.     addq.l    #4,sp
  353.     
  354.     cmpi.b    #27,d0        Esc ?  if so quit
  355.     beq    exit
  356.     cmpi.b    #' ',d0
  357.     beq    copyscreens            
  358.             
  359.     add.w    #1,x_pos
  360.     cmp.w    #319,x_pos
  361.     ble    .y
  362.     clr.w    x_pos
  363. .y    move.w    #142,y_pos
  364.  
  365.     tst.w    countdown        end of delay?
  366.     bpl    .ok2
  367.     addq.w    #1,frame        yes so increment frame number
  368.     move.w    seqend,d0
  369.     cmp.w    frame,d0        last frame in the sequence?
  370.     blt    .nxtseq            yes so reset variables
  371.     move.w    delay,countdown        no so just reset frame delay                            
  372.     bra    .ok2    
  373. .nxtseq    add.l    #6,seq_pos        get next sequence    
  374.     move.l    seq_pos,a0
  375.     tst.w    (a0)            at end of sequence file?
  376.     bpl    .ok            if no then continue
  377.     move.l    #sequence2+16,seq_pos    skip header and first sequence
  378. .ok    move.l    seq_pos,a0        position in the sequence file
  379.     move.w    (a0)+,delay        frame update delay
  380.     move.w    delay,countdown        
  381.     move.w    (a0)+,frame        sequence start
  382.     move.w    (a0)+,seqend        sequence end
  383. .ok2    subq.w    #1,countdown    
  384.  
  385.     move.w    frame,d0
  386.     asl.w    #2,d0
  387.     lea    sprite_table,a0
  388.     move.l    0(a0,d0.w),a0    correct sprite block
  389.     move.w    (a0)+,hight    
  390.     move.w    (a0)+,width
  391.     addq.l    #4,a0        skip length    
  392.     move.l    a0,sprite
  393.     bsr    sprite_routine
  394.  
  395.     bsr    swapscreens
  396.     bra    sync3
  397.  
  398.  
  399. exit
  400.         move.w  sav_484,$484
  401. ;    bset    #0,$484
  402. ;    bset    #1,$484
  403.     
  404.          movem.l syspal,d0-d7    old colors back
  405.     movem.l d0-d7,$ffff8240.w
  406.  
  407.     move.w  oldrez,-(sp)    old resolution back
  408.     move.l  oldscr,-(sp)
  409.     move.l  oldscr,-(sp)
  410.     move.w  #5,-(sp)
  411.     trap    #14
  412.     add.l   #12,sp
  413.  
  414. mouseon    
  415.     move #8,-(sp)            enable mouse reporting
  416.     move #4,-(sp)
  417.     move #3,-(sp)
  418.     trap #13
  419.     addq.l #6,sp
  420.     dc.w $A009            Line-A show mouse
  421. cursor_on
  422.     move.w    #1,-(sp)
  423.     move.w    #21,-(sp)
  424.     trap    #14
  425.     addq.l    #4,sp
  426.  
  427.     move.l  savereg,-(sp)
  428.     move.w  #$20,-(sp)
  429.     trap    #1
  430.     addq.l  #6,sp
  431.  
  432.     clr.w   -(sp)
  433.     trap    #1
  434.  
  435. ***************************
  436. waitkey
  437.     move.w    #7,-(sp)
  438.     trap    #1
  439.     addq.l    #2,sp
  440.     rts
  441. ***************************
  442. swapscreens
  443.     btst    #0,video
  444.     beq    set_1    
  445. set    
  446.     move.w    #-1,-(sp)
  447.     move.l    log,-(sp)
  448.     move.l    phys,-(sp)
  449.     move.w    #5,-(sp)
  450.     trap    #14
  451.     lea    12(sp),sp
  452.     bchg    #0,video
  453.     rts
  454. set_1
  455.     move.w    #-1,-(sp)
  456.     move.l    phys,-(sp)
  457.     move.l    log,-(sp)
  458.     move.w    #5,-(sp)
  459.     trap    #14
  460.     lea    12(sp),sp
  461.     bchg    #0,video
  462.     rts
  463.  
  464. ******************************************
  465. * UNIVERSAL SPRITE ROUTINE. 
  466. * HANDLES MULTIPLE SIZE SPRITES 
  467. * WITH CLIPPING ON THE LOWER BORDER.
  468. * MINIMUM SIZE 1 PIXEL HIGH BY 16 WIDE.
  469. * WIDTH MUST BE A MULTIPLE OF 16.
  470. ******************************************
  471. dummy    dc.b    0    not used
  472. video    dc.b    0    screen toggle flag
  473. log    dc.l    0    logical screen address
  474. phys    dc.l    0    physical screen address
  475. x_pos    dc.w    0    absolute X screen position 0-319
  476. y_pos    dc.w    0    absolute Y screen position 0-199
  477. hight    dc.w    0    sprite hight    
  478. width    dc.w    0    sprite width
  479. sprite    dc.l    0    sprite data address
  480. datbuf1    dc.l    0    buffer 1. Used by sprite routine
  481. bakbuf1    dc.l    0    address    of background restore buffer 1
  482. datbuf2    dc.l    0    buffer 2. Used by sprite routine    
  483. bakbuf2    dc.l    0    address of background restore buffer 2
  484. sprite_routine
  485. * putback *
  486.     btst    #0,video
  487.     bne    res2
  488. res1    move.l    datbuf1,a2
  489.     move.l    bakbuf1,a1
  490.     bra    dores
  491. res2    move.l    datbuf2,a2
  492.     move.l    bakbuf2,a1
  493. dores
  494.     tst.l    (a2)
  495.     beq    ex_put
  496.     move.l    (a2)+,a0
  497.     move.l    (a2)+,d7
  498.     move.l    (a2),d4    
  499.     asr.w    #3,d4        divide by 8 
  500. putloop
  501.     move.l    d4,d5    
  502. put    
  503.     move.l    (a1)+,(a0)+
  504.     move.l    (a1)+,(a0)+
  505.     dbra    d5,put        
  506.     lea    160-8(a0),a0
  507.     sub.l    (a2),a0
  508.     dbra    d7,putloop        
  509. ex_put        
  510. * getback *    
  511.     btst    #0,video
  512.     bne    gbuff2
  513. gbuff1    move.l    datbuf1,a2
  514.     move.l    bakbuf1,a0
  515.     move.l    phys,a1
  516.     bra    doget
  517. gbuff2    move.l    datbuf2,a2
  518.     move.l    bakbuf2,a0 
  519.     move.l    log,a1
  520. doget    
  521.     move.w    x_pos,d0
  522.     move.w    y_pos,d1
  523.     mulu.w    #160,d1
  524.  
  525.     lea    0(a1,d1.w),a1    draw on this line
  526.     moveq    #0,d6
  527.     move.w    d0,d6        save X possition
  528.     lsr.w    #1,d0        divide by 2
  529.     and.w    #$fff8,d0    bring to lower 16 boundry
  530.     lea    0(a1,d0.w),a1    correct screen position 
  531.     move.l    a1,(a2)+    save address for restore
  532.     and.w    #$000f,d6    get shift amount in lower 4 bits (0-15)
  533.     moveq.l    #0,d7
  534.     move.w    hight,d7
  535.     move.w    #199,d5        hight of screen
  536.     sub.w    d7,d5        subtract sprite hight from screen hight        
  537.     cmp    y_pos,d5    is its full hight on screen 
  538.     bhi    .noclip        if so don't clip hight.If not...
  539.     move.l    #199,d7        ...find how much is still on screen
  540.     sub.w    y_pos,d7    move it to loop counter
  541. .noclip    
  542.     subq.l    #1,d7
  543.     move.l    d7,(a2)+    to restor counter
  544.     moveq.l    #0,d4
  545.     move.w    width,d4
  546.     asr.w    d4        divide by 8
  547.     move.l    d4,(a2)        to restor counter
  548.     asr.w    #3,d4        divide by 8 
  549. hightloop
  550.     move.l    d4,d5
  551. widthloop
  552.     move.l    (a1)+,(a0)+        
  553.     move.l    (a1)+,(a0)+
  554.     dbra    d5,widthloop    
  555.     lea    160-8(a1),a1
  556.     sub.l    (a2),a1
  557.     dbra    d7,hightloop        
  558. * putsprite *
  559.     btst    #0,video
  560.     bne    pbuff2
  561. pbuff1    move.l    datbuf1,a2
  562.     bra    doput
  563. pbuff2    move.l    datbuf2,a2
  564. doput    
  565.     move.l    sprite,a0    sprite data address    
  566.     move.l    (a2)+,a1    screen address
  567.     move.l    (a2)+,d7    line loop counter
  568. sprite_draw
  569.     move.l    (a2),d5    width loop counter
  570.     asr.w    #3,d5        divide by 8 
  571.     subq.l    #1,d5
  572. spritedraw    
  573.     moveq    #-1,d0
  574.     moveq    #0,d1
  575.     moveq    #0,d2
  576.     moveq    #0,d3
  577.     moveq    #0,d4
  578.     move.w    (a0)+,d0    * mask
  579.     move.w    (a0)+,d1    * plane 1
  580.     move.w    (a0)+,d2    * plane 2
  581.     move.w    (a0)+,d3    * plane 3
  582.     move.w    (a0)+,d4    * plane 4
  583.     ror.l    d6,d0        * shift mask and planes into place
  584.     ror.l    d6,d1
  585.     ror.l    d6,d2
  586.     ror.l    d6,d3
  587.     ror.l    d6,d4
  588.     and.w    d0,(a1)        * lay down the mask and data
  589.     or.w    d1,(a1)+
  590.     and.w    d0,(a1)
  591.     or.w    d2,(a1)+
  592.     and.w    d0,(a1)
  593.     or.w    d3,(a1)+
  594.     and.w    d0,(a1)
  595.     or.w    d4,(a1)+
  596.     swap    d0
  597.     swap    d1
  598.     swap    d2
  599.     swap    d3
  600.     swap    d4
  601.     and.w    d0,(a1)    
  602.     or.w    d1,(a1)+
  603.     and.w    d0,(a1)    
  604.     or.w    d2,(a1)+
  605.     and.w    d0,(a1)    
  606.     or.w    d3,(a1)+
  607.     and.w    d0,(a1)    
  608.     or.w    d4,(a1)+
  609.     lea    -8(a1),a1
  610.     dbra    d5,spritedraw    
  611.     lea    160(a1),a1
  612.     sub.l    (a2),a1    
  613.     dbra    d7,sprite_draw
  614.     rts    
  615.  
  616. oldrez    dc.w    0        * old system resolution
  617. oldscr    dc.l    0        * old system screen address
  618. savereg    dc.l    0        * old stack address        
  619. sav_484    dc.w    0        * saved system vaiable (key click/repeat)
  620. handle    dc.w    0        * file handle
  621. pathpos    dc.l    path+6        * +10 to skip header    
  622. seq_pos    dc.l    sequence+10    * +10 to skip header    
  623. delay    dc.w    0        * frame delay store
  624. countdown            * frame delay countdown
  625.     dc.w    0        * delay countdown
  626. frame    dc.w    0        * current frame number in the sequence 
  627. seqend    dc.w    0        * last frame number in the sequence    
  628. picture    dc.b    'a:\spritefx\source\backdrop.pi1',0
  629. ***************************************************
  630. ***************************************************
  631. * Following binary files included at assembly time.
  632. * Alternatively, ascii versions of these files can 
  633. * be combined with the source code. These files are
  634. * also on disk but remember to change the routines
  635. * to suit these files eg. #sequence+10 to #sequence
  636. * because of the absence of header data.  
  637. ***************************************************
  638. ***************************************************
  639. spritedata
  640.     incbin    a:\spritefx\source\sprites.spr
  641. ghostdata
  642.     incbin    a:\spritefx\source\ghost.spr
  643. sequence
  644.     incbin    a:\spritefx\source\sprites.seq
  645. sequence2
  646.     incbin    a:\spritefx\source\ghost.seq
  647. path    incbin    a:\spritefx\source\sprites.plt
  648. path1end
  649. path2    incbin    a:\spritefx\source\ghost.plt
  650. path2end
  651. ***************************************************
  652. ***************************************************
  653.  
  654.     section bss
  655. syspal    ds.b    32
  656. palette    ds.b    34
  657. data_buffer_1a
  658.     ds.l    4    screen 1 data
  659. data_buffer_2b
  660.     ds.l    4    screen 2 data
  661. back_buffer_1a
  662.     ds.b    256*16    screen 1 background save buffer
  663. back_buffer_2b
  664.     ds.b    256*16    screen 2 background save buffer
  665.  
  666. sprite_table        * Table of sprite addresses
  667.     ds.l    16    * Number of sprites. Adjust as nessecary
  668. picbuffer
  669.     ds.b    32000    
  670. screen1    ds.b    32000+256
  671. screen2    ds.b    32000+256
  672.     even
  673. **********************************
  674.     ds.w    512
  675. stack    ds.l    0
  676.